package tech.wetech.admin.modules.system.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import tech.wetech.admin.core.utils.Result;
import tech.wetech.admin.modules.system.po.CCBSKRequest;
import tech.wetech.admin.modules.system.po.CCBUpdateSKRequest;
import tech.wetech.admin.modules.system.service.CCBPayService;

/**
 * @author
 * @description 建行下载
 * @date 2019年09月05日 14:08
 */
@RestController
@RequestMapping("/ccb/")
public class CCBController {

  @Autowired
  private CCBPayService ccbPayService;


  @PostMapping("/downloadsk")
  public Result<?> downloadsk(@RequestBody @Validated CCBSKRequest request) {
    return Result.success(ccbPayService.downloadSecretKey(request));
  }

  @PostMapping("/updatesk")
  public Result<?> updateSk(@RequestBody @Validated CCBUpdateSKRequest request) throws InterruptedException {
    return Result.success(ccbPayService.updateSecretKey(request.getCompanyId()));
  }
}
